package com.pack;

import java.util.Calendar;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Richiesta al server per farsi dire il santo del giorno        
        setContentView(R.layout.main);       
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    	MenuItem comandoNew=menu.add(Menu.NONE, MENUITEM_COMANDO_ADDCONTACT, 1, "Add Contact");
    	comandoNew.setIcon(R.drawable.plus);
    	MenuItem comandoSearch=menu.add(Menu.NONE, MENUITEM_COMANDO_SEARCHCONTACT, 2, "Contact Search");
    	comandoSearch.setIcon(R.drawable.search);
    	MenuItem comandoSetting=menu.add(Menu.NONE, MENUITEM_COMANDO_SETTING, 3, "Settings");
    	comandoSetting.setIcon(R.drawable.settings);
    	return true;    	
    } 
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
    	int id=item.getItemId();
    	switch (id) {
    	case MENUITEM_COMANDO_ADDCONTACT:
    		Intent intentAddContact=new Intent(this, AddContactActivity.class);
    		startActivity(intentAddContact);
    		return true;
    	case MENUITEM_COMANDO_SEARCHCONTACT:
    		Intent intentSearchContact=new Intent(this, ListViewActivity.class);
    		startActivity(intentSearchContact);
    		return true;
    	case MENUITEM_COMANDO_SETTING:
    		Intent intentSetting=new Intent(this, SettingActivity.class);
    		startActivity(intentSetting);
    		return true;
    	}
    	return false;
    }
    
    private static final int MENUITEM_COMANDO_ADDCONTACT = 1;
    private static final int MENUITEM_COMANDO_SEARCHCONTACT = 2;
    private static final int MENUITEM_COMANDO_SETTING = 3;
}